<?php
//if (IN_MANAGER_MODE != 'true') die("Please use module path in "); 

// static definitions
if(!defined('STARGB_PATH')) {
    define('STARGB_PATH', MODX_BASE_PATH . 'assets/modules/stargb/');
}
if(!defined('STARGB_URL')) {
    define('STARGB_URL', MODX_BASE_URL . 'assets/modules/stargb/');
}

// StarGB
require_once STARGB_PATH . 'StarGB.php';

$a = $_a = (int) $_GET['a'];
$id = $_id = (int) $_GET['id'];
$gb = new StarGB($modx, $GLOBALS, $a, $id);

// language
require_once STARGB_PATH . 'StarLng.php';
if (file_exists(STARGB_PATH . 'lng/'.$gb->getConfig('language').'.ini')) {
    StarLng::load(STARGB_PATH . 'lng/'.$gb->getConfig('language').'.ini');
}

$action = 'index';
if (!empty($_GET['action'])) {
    $action = preg_replace("/[^a-zA-Z]/", '', $_GET['action']);
}

$gb->dispatch($action);

/*

mysql_select_db(str_replace('`', '', $GLOBALS['dbase']));
@mysql_query("{$GLOBALS['database_connection_method']} {$GLOBALS['database_connection_charset']}");

//echo StarLng::get('version');
*/